﻿using VisualWip.Core;
using VisualWip.Core.Columns;
using VisualWip.Core.Interfaces;

namespace VisualWip.PresentationModel.Uri
{
    public class UriColumnSettingsViewModel : SettingsViewModelBase<UriColumn>
    {
        public UriColumnSettingsViewModel(Application application, UriColumn column, IColumnTypeProvider columnTypeProvider)
            : base(application, column,columnTypeProvider)
        {
        }

        public override string SettingsWindowName
        {
            get { return "Uri column settings"; }
        }

        public string Uri
        {
            get { return Column.Uri != null ? Column.Uri.ToString() : string.Empty; }
            set
            {
                if (value != Uri && !string.IsNullOrWhiteSpace(value))
                {
                    Column.Uri = new System.Uri(value);
                    OnPropertyChanged(this, () => Uri);
                }
            }
        }
    }
}